package base.dataStructure;

public class LinkedListMe<E> {

    transient int size = 0;
    transient Node<E> first;
    transient Node<E> last;

    public LinkedListMe() {
    }

    private boolean add(E e) {
        linkLast(e);
        return true;
    }

    void linkLast(E e) {
        final Node<E> l = last;
        final Node<E> newNode = new Node<>(e, null, l);
        last = newNode;
        if (l == null) {
            first = newNode;
        } else {
            l.next = newNode;
        }
        size++;
    }


    private static class Node<E> {
        E item;
        Node<E> next;
        Node<E> prev;

        public Node(E item, Node<E> next, Node<E> prev) {
            this.item = item;
            this.next = next;
            this.prev = prev;
        }
    }

    public static void main(String[] args) {
        LinkedListMe<Object> linkedListMe = new LinkedListMe<>();
        linkedListMe.add(1);
        System.out.println(linkedListMe);
    }
}
